<#include "../inc/view.html"/>
<@view>
            <div class="row">
                <div class="col-sm-12">
                    <div class="row">
                        <div class="col-sm-6">
                            <ol class="breadcrumb">
                                <li>
                                    <b>内容管理</b>
                                </li>
                                <li class="active">
                                    领导
                                </li>
                            </ol>
                        </div>
                        <div class="col-sm-6">
                            <button class="btn-sm btn-success pull-right" onclick="contentLoadPage('/leader/add')"><i class="fa fa-plus"></i>新增</button>
                        </div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-sm-12">
                            <table class="table table-bordered table-striped table-hover m-0">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th width="50px">&nbsp;</th>
                                    <th>领导姓名</th>
                                    <th>职务</th>
                                    <th>状态</th>
                                    <th>排序</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <#if page.list??>
                                    <#list page.list as m>
                                        <tr>
                                            <td>${m_index+1}</td>
                                            <td><img src="${m.img!}" style="max-height:50px;max-width:50px;"></td>
                                            <td>${m.name!}</td>
                                            <td>${m.job!}</td>
                                            <td><#if 1==m.status!0 ><span class="green">启用</span><#else><span class="red">禁用</span></#if></td>
                                            <td>${m.sort!}</td>
                                            <td>
                                                <a href="javascript:void(0);" onclick="contentLoadPage('/leader/add/${m.id}')"><i class="fa fa-edit"></i>编辑</a>
                                                <a href="javascript:void(0);" onclick="delleader('${m.id}')"><i class="fa red fa-trash"></i>删除</a>
                                            </td>
                                        </tr>
                                    </#list>
                                </#if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-sm-12">
                            <div id="page2" class="pull-right"></div>
                        </div>
                    </div>
                </div>
            </div>
</@view>
<script>
    function delleader(id_){
        layer.confirm('确定要删除此领导吗？', {
            btn: ['删除','取消'],shadeClose:true
        },function() {
            $.ajax({
                url: '/admin/leader/del/' + id_, success: function (json) {
                    if (json.code == RESULT_SUCCESS) {
                        contentLoadPage('/leader');
                        layer.closeAll();
                    } else {
                        if (json.msg)
                            layer.alert(json.msg, {icon: 5, title: '系统提示',time:3000,shadeClose:true});
                    }
                }
            });
        },function(){

        });
    }
    function doSearch(pageNum){
        if(pageNum){
            $("#pageNumber").val(pageNum);
        }
        contentLoadPage("/leader",$("#searchForm").serialize());
    }
    $(function(){
        laypage({
            cont: 'page2',
            pages:${page.totalPage!1},
            curr:${page.pageNumber!1},
            jump: function (obj, first) {
                if (!first) {
                    doSearch(obj.curr);
                }
            }
        });
    });
</script>